package exception;

import org.apache.log4j.Logger;


@SuppressWarnings("serial")
public abstract class NewException extends Exception {


	private Logger mLogger = Logger.getLogger(NewException.class.getName());
	private Exception mException;
	private String mMessage = "";
	protected NewException(Exception aException){
		super();
		if(aException instanceof NewException){
			mException = ((NewException) aException).getFirstException();
			mMessage += aException;
		}else{
			mLogger.debug(aException);
			mException = aException;
		}
	}

	protected String getExceptionMessage() {
		return "\n" +mMessage+"\n"+ mException;
	}
	
	public Exception getFirstException(){
		return mException;
	}
}
